package com.tm.chargecar.controller;

import com.tm.chargecar.entity.SiteDogcartEntity;
import com.tm.chargecar.result.Result;
import com.tm.chargecar.service.SiteDogcartService;
import com.tm.chargecar.vo.SiteDogcartVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 站点管理-两轮车充电站
 *
 * @author wangJie
 * @create 2022-08-24 9:50
 */

@RestController
@RequestMapping("site")
public class SiteDogcartController {

    @Autowired
    private SiteDogcartService siteDogcartService;

    /**
     * 查询站点信息//条件查
     *
     * @return
     */
        @GetMapping("querySite")
    public Result querySite(@RequestBody SiteDogcartVo sv) {


        return  siteDogcartService.querySite(sv);
    }

    /**
     * 新增站点
     *
     * @param siteDogcartEntity
     * @return
     */
    @PostMapping("insertSite")
    public Result insertSite(@RequestBody SiteDogcartEntity siteDogcartEntity) {
        siteDogcartService.insertSite(siteDogcartEntity);
        return Result.SUCCESS();
    }

    /**
         * 修改状态
     * @param siteDogcartEntity
     * @return
     */
    @PutMapping("updateState")
    public Result updateState(@RequestBody SiteDogcartEntity siteDogcartEntity) {
        siteDogcartService.updateState(siteDogcartEntity);
        return Result.SUCCESS();
    }

    /**
     * 修改全部
     * @param siteDogcartEntity
     * @return
     */
    @PutMapping("updateAll")
    public Result updateAll(@RequestBody SiteDogcartEntity siteDogcartEntity){
        siteDogcartService.updateAll(siteDogcartEntity);
        return  Result.SUCCESS();
    }

    /**
     * 根据编号联查计费模板
     * @return
     */
    @GetMapping("queryBySiteNum")
    public Result queryBySiteNum(@RequestBody SiteDogcartEntity sitNum){

        return Result.SUCCESS(siteDogcartService.queryBySiteNum(sitNum));
    }
}
